using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using FetCo.Data;
using ADESSA.Entities;
using ADESSA.Business;
using FetCo.Framework;

/// <summary>
/// Summary description for AllAds
/// </summary>
public class AllAds
{
    #region start Adv Home
    #region Load test javascript
    public static string LoadAdvs()
    {
        string str = "";
        Criteria cri = new Criteria();
        cri.add("[" + CatLocation._Table + "].[" + CatLocationColumns.Title + "]", FetConstant.HomeOutLeft, Condition.LIKE, Condition.AND);
        cri.add("[" + CatLocation._Table + "].[" + CatLocationColumns.Enable + "]", 1, Condition.LIKE, Condition.AND);
        CatLocationCollection _CatLocationCollection = CatLocationService.GetCatLocationListByParam(CatLocationColumns.LocationId, OrderDirection.ASC, cri.Criter);
        if (_CatLocationCollection.Count > 0)
        {
            Criteria crit = new Criteria();
            crit.add(BannerLocationColumns.CatLocationId, _CatLocationCollection[0].LocationId, Condition.EQUAL, Condition.AND);
            crit.add(BannerLocationColumns.Enable, 1, Condition.EQUAL, Condition.AND);
            BannerLocationCollection _BannerLocationCollection = BannerLocationService.GetBannerLocationListByParam("[" + BannerLocation._Table + "].[" + BannerLocationColumns.Order + "]", OrderDirection.ASC, crit.Criter);
            string fadeshow = "fadeshow";
            if (_BannerLocationCollection.Count > 0)
            {
                for (int i = 0; i < _BannerLocationCollection.Count; i++)
                {
                    Tb_Size _Tb_Size = Tb_SizeService.GetTb_Size(_BannerLocationCollection[i].SizeID);
                    Criteria crite = new Criteria();
                    crite.add(BannerColumns.BannerLocationId, _BannerLocationCollection[i].BannerLocationId, Condition.EQUAL, Condition.AND);
                    crite.add(BannerColumns.FlashStartus, 0, Condition.EQUAL, Condition.AND);
                    crite.add(BannerColumns.StatusId, FetConstant._active, Condition.EQUAL, Condition.AND);
                    BannerCollection _BannerCollection = BannerService.GetBannerListByParam(BannerColumns.Viewed, OrderDirection.ASC, crite.Criter);
                    if (_BannerCollection.Count > 0)
                    {
                        str += " <script type='text/javascript'>";
                        str += "     var mygallery=new fadeSlideShow({";
                        str += "         wrapperid: '" + fadeshow + i + "',"; //ID of blank DIV on page to house Slideshow
                        str += "         dimensions: [" + _Tb_Size.WidthSize + ", " + _Tb_Size.HightSize + "],"; //width/height of gallery in pixels. Should reflect dimensions of largest image
                        str += "         imagearray: [";
                        string strImage0 = "";
                        for (int j = 0; j < _BannerCollection.Count; j++)
                        {
                            string strImage = RTISettings.BannerFolder.Replace("~/", "") + "/" + _BannerCollection[j].BannePath;
                            strImage0 = RTISettings.BannerFolder.Replace("~/", "") + "/" + _BannerCollection[0].BannePath;
                            str += "['" + strImage + "','" + _BannerCollection[j].BannerLink + "','_new', '" + _BannerCollection[j].Title + "'],";
                        }
                        str += "['" + strImage0 + "','" + _BannerCollection[0].BannerLink + "','_new', '" + _BannerCollection[0].Title + "'],";
                        str += "           ],";
                        str += "        displaymode: {type:'auto', pause:2500, cycles:0, wraparound:false},";
                        str += "        persist: false,"; //remember last viewed slide and recall within same session?
                        str += "        fadeduration: 500,"; //transition duration (milliseconds)
                        str += "        descreveal: 'ondemand',";
                        str += "        togglerid: ''";
                        str += "     })";
                        str += "    </script>";
                        str += "<div id='" + fadeshow + i + "'></div>";
                    }
                    else
                    {
                        Criteria criter = new Criteria();
                        criter.add(BannerColumns.BannerLocationId, _BannerLocationCollection[i].BannerLocationId, Condition.EQUAL, Condition.AND);
                        criter.add(BannerColumns.FlashStartus, 1, Condition.EQUAL, Condition.AND);
                        criter.add(BannerColumns.StatusId, FetConstant._active, Condition.EQUAL, Condition.AND);
                        BannerCollection _BannerCollectionFlash = BannerService.GetBannerListByParam(BannerColumns.Viewed, OrderDirection.ASC, criter.Criter);
                        if (_BannerCollectionFlash.Count > 0)
                        {
                            string strflash = RTISettings.BannerFolder.Replace("~/", "") + "/" + _BannerCollectionFlash[0].BannePath;
                            str += "<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0'  width='" + _Tb_Size.WidthSize + "' height='" + _Tb_Size.HightSize + "' >" +
                                "   <param name='movie' value='" + strflash + "'> " +
                                "  <param name='quality' value='high'> " +
                                " <param name='wmode' value='transparent'> " +
                                " <embed src='" + strflash + "' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' height='" + _Tb_Size.HightSize + "'  width='" + _Tb_Size.WidthSize + "' wmode='transparent'></embed></object> ";
                        }
                    }
                }
            }
        }
        return str;
    }
    #endregion Load test javascript
    #region Load adv home Center
    public static string LoadHomeCenter()
    {
        string str = "";
        Criteria cri = new Criteria();
        cri.add("[" + CatLocation._Table + "].[" + CatLocationColumns.Title + "]", FetConstant.HomeCenter, Condition.LIKE, Condition.AND);
        cri.add("[" + CatLocation._Table + "].[" + CatLocationColumns.Enable + "]", 1, Condition.LIKE, Condition.AND);
        CatLocationCollection _CatLocationCollection = CatLocationService.GetCatLocationListByParam(CatLocationColumns.LocationId, OrderDirection.ASC, cri.Criter);
        if (_CatLocationCollection.Count > 0)
        {
            Criteria crit = new Criteria();
            crit.add(BannerLocationColumns.CatLocationId, _CatLocationCollection[0].LocationId, Condition.EQUAL, Condition.AND);
            crit.add(BannerLocationColumns.Enable, 1, Condition.EQUAL, Condition.AND);
            BannerLocationCollection _BannerLocationCollection = BannerLocationService.GetBannerLocationListByParam("[" + BannerLocation._Table + "].[" + BannerLocationColumns.Order + "]", OrderDirection.ASC, crit.Criter);            
            string width0 = "";
            string height0 = "";
            int countLocation = 0;
            int countBanner = 0;
            if (_BannerLocationCollection.Count > 0)
            {
                countLocation = int.Parse(_BannerLocationCollection.Count.ToString())-1;
                str += " <script type='text/javascript'>";
                str += "     var VarHomCenter = new Array(";
                for (int i = 0; i < _BannerLocationCollection.Count; i++)
                {
                    if (countLocation > i)
                    {
                        Tb_Size _Tb_Size = Tb_SizeService.GetTb_Size(_BannerLocationCollection[i].SizeID);                     
                        Criteria crite = new Criteria();
                        crite.add(BannerColumns.BannerLocationId, _BannerLocationCollection[i].BannerLocationId, Condition.EQUAL, Condition.AND);
                        crite.add(BannerColumns.StatusId, FetConstant._active, Condition.EQUAL, Condition.AND);
                        BannerCollection _BannerCollection = BannerService.GetBannerListByParam(BannerColumns.Viewed, OrderDirection.ASC, crite.Criter);

                        if (_BannerCollection.Count > 0)
                        {
                            for (int j = 0; j < _BannerCollection.Count; j++)
                            {
                                string strImage = FetConstant.strhrf + _BannerCollection[j].BannePath;
                                str += "  new Array('" + strImage + "', '" + _BannerCollection[j].BannerLink + "', '" + FetConstant.strTagetBlak + "', " + _Tb_Size.WidthSize + ", " + _Tb_Size.HightSize + ", " + _BannerLocationCollection[i].BannerLocationId + ", 0),";
                            }
                        }
                    }
                    else
                    {
                        Tb_Size _Tb_Size = Tb_SizeService.GetTb_Size(_BannerLocationCollection[i].SizeID);
                        width0 = _Tb_Size.WidthSize.ToString();
                        height0 = _Tb_Size.HightSize.ToString();
                        Criteria crite = new Criteria();
                        crite.add(BannerColumns.BannerLocationId, _BannerLocationCollection[i].BannerLocationId, Condition.EQUAL, Condition.AND);
                        crite.add(BannerColumns.StatusId, FetConstant._active, Condition.EQUAL, Condition.AND);
                        BannerCollection _BannerCollection = BannerService.GetBannerListByParam(BannerColumns.Viewed, OrderDirection.ASC, crite.Criter);
                        if (_BannerCollection.Count > 0)
                        {
                            countBanner = int.Parse(_BannerCollection.Count.ToString())-1;
                           
                            for (int j = 0; j < _BannerCollection.Count; j++)
                            {
                                if (countBanner > j)
                                {
                                    string strImage = FetConstant.strhrf + _BannerCollection[j].BannePath;
                                    str += "  new Array('" + strImage + "', '" + _BannerCollection[j].BannerLink + "', '" + FetConstant.strTagetBlak + "', " + _Tb_Size.WidthSize + ", " + _Tb_Size.HightSize + ", " + _BannerLocationCollection[i].BannerLocationId + ", 0),";
                                }
                                else
                                {
                                    string strImage = FetConstant.strhrf + _BannerCollection[j].BannePath;
                                    str += "  new Array('" + strImage + "', '" + _BannerCollection[j].BannerLink + "', '" + FetConstant.strTagetBlak + "', " + _Tb_Size.WidthSize + ", " + _Tb_Size.HightSize + ", " + _BannerLocationCollection[i].BannerLocationId + ", 0)";
                                }
                            }
                        }

                    }

                }
                str += ");";
                str += "    </script>";
            }
        }
        return str;
    }
    #endregion Load adv home right big new
    #region Load adv home Left
    public static string LoadHomeLeft()
    {
        string str = "";
        Criteria cri = new Criteria();
        cri.add("[" + CatLocation._Table + "].[" + CatLocationColumns.Title + "]", FetConstant.HomeLeft, Condition.LIKE, Condition.AND);
        cri.add("[" + CatLocation._Table + "].[" + CatLocationColumns.Enable + "]", 1, Condition.LIKE, Condition.AND);
        CatLocationCollection _CatLocationCollection = CatLocationService.GetCatLocationListByParam(CatLocationColumns.LocationId, OrderDirection.ASC, cri.Criter);
        if (_CatLocationCollection.Count > 0)
        {
            Criteria crit = new Criteria();
            crit.add(BannerLocationColumns.CatLocationId, _CatLocationCollection[0].LocationId, Condition.EQUAL, Condition.AND);
            crit.add(BannerLocationColumns.Enable, 1, Condition.EQUAL, Condition.AND);
            BannerLocationCollection _BannerLocationCollection = BannerLocationService.GetBannerLocationListByParam("[" + BannerLocation._Table + "].[" + BannerLocationColumns.Order + "]", OrderDirection.ASC, crit.Criter);
            string width0 = "";
            string height0 = "";
            int countLocation = 0;
            int countBanner = 0;
            if (_BannerLocationCollection.Count > 0)
            {
                countLocation = int.Parse(_BannerLocationCollection.Count.ToString()) - 1;
                str += " <script type='text/javascript'>";
                str += "     var VarHomeLeft = new Array(";
                for (int i = 0; i < _BannerLocationCollection.Count; i++)
                {
                    if (countLocation > i)
                    {
                        Tb_Size _Tb_Size = Tb_SizeService.GetTb_Size(_BannerLocationCollection[i].SizeID);
                        Criteria crite = new Criteria();
                        crite.add(BannerColumns.BannerLocationId, _BannerLocationCollection[i].BannerLocationId, Condition.EQUAL, Condition.AND);
                        crite.add(BannerColumns.StatusId, FetConstant._active, Condition.EQUAL, Condition.AND);
                        BannerCollection _BannerCollection = BannerService.GetBannerListByParam(BannerColumns.Viewed, OrderDirection.ASC, crite.Criter);

                        if (_BannerCollection.Count > 0)
                        {
                            for (int j = 0; j < _BannerCollection.Count; j++)
                            {
                                string strImage = FetConstant.strhrf + _BannerCollection[j].BannePath;
                                str += "  new Array('" + strImage + "', '" + _BannerCollection[j].BannerLink + "', '" + FetConstant.strTagetBlak + "', " + _Tb_Size.WidthSize + ", " + _Tb_Size.HightSize + ", " + _BannerLocationCollection[i].BannerLocationId + ", 0),";
                            }
                        }
                    }
                    else
                    {
                        Tb_Size _Tb_Size = Tb_SizeService.GetTb_Size(_BannerLocationCollection[i].SizeID);
                        width0 = _Tb_Size.WidthSize.ToString();
                        height0 = _Tb_Size.HightSize.ToString();
                        Criteria crite = new Criteria();
                        crite.add(BannerColumns.BannerLocationId, _BannerLocationCollection[i].BannerLocationId, Condition.EQUAL, Condition.AND);
                        crite.add(BannerColumns.StatusId, FetConstant._active, Condition.EQUAL, Condition.AND);
                        BannerCollection _BannerCollection = BannerService.GetBannerListByParam(BannerColumns.Viewed, OrderDirection.ASC, crite.Criter);
                        if (_BannerCollection.Count > 0)
                        {
                            countBanner = int.Parse(_BannerCollection.Count.ToString()) - 1;

                            for (int j = 0; j < _BannerCollection.Count; j++)
                            {
                                if (countBanner > j)
                                {
                                    string strImage = FetConstant.strhrf + _BannerCollection[j].BannePath;
                                    str += "  new Array('" + strImage + "', '" + _BannerCollection[j].BannerLink + "', '" + FetConstant.strTagetBlak + "', " + _Tb_Size.WidthSize + ", " + _Tb_Size.HightSize + ", " + _BannerLocationCollection[i].BannerLocationId + ", 0),";
                                }
                                else
                                {
                                    string strImage = FetConstant.strhrf + _BannerCollection[j].BannePath;
                                    str += "  new Array('" + strImage + "', '" + _BannerCollection[j].BannerLink + "', '" + FetConstant.strTagetBlak + "', " + _Tb_Size.WidthSize + ", " + _Tb_Size.HightSize + ", " + _BannerLocationCollection[i].BannerLocationId + ", 0)";
                                }
                            }
                        }

                    }

                }
                str += ");";
                str += "    </script>";
            }
        }
        return str;
    }
    #endregion Load adv home right small new
    #region Load adv home Right
    public static string LoadHomeRight()
    {
        string str = "";
        Criteria cri = new Criteria();
        cri.add("[" + CatLocation._Table + "].[" + CatLocationColumns.Title + "]", FetConstant.HomeRight, Condition.LIKE, Condition.AND);
        cri.add("[" + CatLocation._Table + "].[" + CatLocationColumns.Enable + "]", 1, Condition.LIKE, Condition.AND);
        CatLocationCollection _CatLocationCollection = CatLocationService.GetCatLocationListByParam(CatLocationColumns.LocationId, OrderDirection.ASC, cri.Criter);
        if (_CatLocationCollection.Count > 0)
        {
            Criteria crit = new Criteria();
            crit.add(BannerLocationColumns.CatLocationId, _CatLocationCollection[0].LocationId, Condition.EQUAL, Condition.AND);
            crit.add(BannerLocationColumns.Enable, 1, Condition.EQUAL, Condition.AND);
            BannerLocationCollection _BannerLocationCollection = BannerLocationService.GetBannerLocationListByParam("[" + BannerLocation._Table + "].[" + BannerLocationColumns.Order + "]", OrderDirection.ASC, crit.Criter);
            string width0 = "";
            string height0 = "";
            int countLocation = 0;
            int countBanner = 0;
            if (_BannerLocationCollection.Count > 0)
            {
                countLocation = int.Parse(_BannerLocationCollection.Count.ToString()) - 1;
                str += " <script type='text/javascript'>";
                str += "     var VarHomeRight = new Array(";
                for (int i = 0; i < _BannerLocationCollection.Count; i++)
                {
                    if (countLocation > i)
                    {
                        Tb_Size _Tb_Size = Tb_SizeService.GetTb_Size(_BannerLocationCollection[i].SizeID);
                        Criteria crite = new Criteria();
                        crite.add(BannerColumns.BannerLocationId, _BannerLocationCollection[i].BannerLocationId, Condition.EQUAL, Condition.AND);
                        crite.add(BannerColumns.StatusId, FetConstant._active, Condition.EQUAL, Condition.AND);
                        BannerCollection _BannerCollection = BannerService.GetBannerListByParam(BannerColumns.Viewed, OrderDirection.ASC, crite.Criter);

                        if (_BannerCollection.Count > 0)
                        {
                            for (int j = 0; j < _BannerCollection.Count; j++)
                            {
                                string strImage = FetConstant.strhrf + _BannerCollection[j].BannePath;
                                str += "  new Array('" + strImage + "', '" + _BannerCollection[j].BannerLink + "', '" + FetConstant.strTagetBlak + "', " + _Tb_Size.WidthSize + ", " + _Tb_Size.HightSize + ", " + _BannerLocationCollection[i].BannerLocationId + ", 0),";
                            }
                        }
                    }
                    else
                    {
                        Tb_Size _Tb_Size = Tb_SizeService.GetTb_Size(_BannerLocationCollection[i].SizeID);
                        width0 = _Tb_Size.WidthSize.ToString();
                        height0 = _Tb_Size.HightSize.ToString();
                        Criteria crite = new Criteria();
                        crite.add(BannerColumns.BannerLocationId, _BannerLocationCollection[i].BannerLocationId, Condition.EQUAL, Condition.AND);
                        crite.add(BannerColumns.StatusId, FetConstant._active, Condition.EQUAL, Condition.AND);
                        BannerCollection _BannerCollection = BannerService.GetBannerListByParam(BannerColumns.Viewed, OrderDirection.ASC, crite.Criter);
                        if (_BannerCollection.Count > 0)
                        {
                            countBanner = int.Parse(_BannerCollection.Count.ToString()) - 1;

                            for (int j = 0; j < _BannerCollection.Count; j++)
                            {
                                if (countBanner > j)
                                {
                                    string strImage = FetConstant.strhrf + _BannerCollection[j].BannePath;
                                    str += "  new Array('" + strImage + "', '" + _BannerCollection[j].BannerLink + "', '" + FetConstant.strTagetBlak + "', " + _Tb_Size.WidthSize + ", " + _Tb_Size.HightSize + ", " + _BannerLocationCollection[i].BannerLocationId + ", 0),";
                                }
                                else
                                {
                                    string strImage = FetConstant.strhrf + _BannerCollection[j].BannePath;
                                    str += "  new Array('" + strImage + "', '" + _BannerCollection[j].BannerLink + "', '" + FetConstant.strTagetBlak + "', " + _Tb_Size.WidthSize + ", " + _Tb_Size.HightSize + ", " + _BannerLocationCollection[i].BannerLocationId + ", 0)";
                                }
                            }
                        }

                    }

                }
                str += ");";
                str += "    </script>";
            }
        }
        return str;
    }
    #endregion Load adv home Center Y new
    #region Load adv Product
    public static string LoadProductRight()
    {
        string str = "";
        Criteria cri = new Criteria();
        cri.add("[" + CatLocation._Table + "].[" + CatLocationColumns.Title + "]", FetConstant.ProductRight, Condition.LIKE, Condition.AND);
        cri.add("[" + CatLocation._Table + "].[" + CatLocationColumns.Enable + "]", 1, Condition.LIKE, Condition.AND);
        CatLocationCollection _CatLocationCollection = CatLocationService.GetCatLocationListByParam(CatLocationColumns.LocationId, OrderDirection.ASC, cri.Criter);
        if (_CatLocationCollection.Count > 0)
        {
            Criteria crit = new Criteria();
            crit.add(BannerLocationColumns.CatLocationId, _CatLocationCollection[0].LocationId, Condition.EQUAL, Condition.AND);
            crit.add(BannerLocationColumns.Enable, 1, Condition.EQUAL, Condition.AND);
            BannerLocationCollection _BannerLocationCollection = BannerLocationService.GetBannerLocationListByParam("[" + BannerLocation._Table + "].[" + BannerLocationColumns.Order + "]", OrderDirection.ASC, crit.Criter);
            string width0 = "";
            string height0 = "";
            int countLocation = 0;
            int countBanner = 0;
            if (_BannerLocationCollection.Count > 0)
            {
                countLocation = int.Parse(_BannerLocationCollection.Count.ToString()) - 1;
                str += " <script type='text/javascript'>";
                str += "     var VarProductRight = new Array(";
                for (int i = 0; i < _BannerLocationCollection.Count; i++)
                {
                    if (countLocation > i)
                    {
                        Tb_Size _Tb_Size = Tb_SizeService.GetTb_Size(_BannerLocationCollection[i].SizeID);
                        Criteria crite = new Criteria();
                        crite.add(BannerColumns.BannerLocationId, _BannerLocationCollection[i].BannerLocationId, Condition.EQUAL, Condition.AND);
                        crite.add(BannerColumns.StatusId, FetConstant._active, Condition.EQUAL, Condition.AND);
                        BannerCollection _BannerCollection = BannerService.GetBannerListByParam(BannerColumns.Viewed, OrderDirection.ASC, crite.Criter);

                        if (_BannerCollection.Count > 0)
                        {
                            for (int j = 0; j < _BannerCollection.Count; j++)
                            {
                                string strImage = FetConstant.strhrf + _BannerCollection[j].BannePath;
                                str += "  new Array('" + strImage + "', '" + _BannerCollection[j].BannerLink + "', '" + FetConstant.strTagetBlak + "', " + _Tb_Size.WidthSize + ", " + _Tb_Size.HightSize + ", " + _BannerLocationCollection[i].BannerLocationId + ", 0),";
                            }
                        }
                    }
                    else
                    {
                        Tb_Size _Tb_Size = Tb_SizeService.GetTb_Size(_BannerLocationCollection[i].SizeID);
                        width0 = _Tb_Size.WidthSize.ToString();
                        height0 = _Tb_Size.HightSize.ToString();
                        Criteria crite = new Criteria();
                        crite.add(BannerColumns.BannerLocationId, _BannerLocationCollection[i].BannerLocationId, Condition.EQUAL, Condition.AND);
                        crite.add(BannerColumns.StatusId, FetConstant._active, Condition.EQUAL, Condition.AND);
                        BannerCollection _BannerCollection = BannerService.GetBannerListByParam(BannerColumns.Viewed, OrderDirection.ASC, crite.Criter);
                        if (_BannerCollection.Count > 0)
                        {
                            countBanner = int.Parse(_BannerCollection.Count.ToString()) - 1;

                            for (int j = 0; j < _BannerCollection.Count; j++)
                            {
                                if (countBanner > j)
                                {
                                    string strImage = FetConstant.strhrf + _BannerCollection[j].BannePath;
                                    str += "  new Array('" + strImage + "', '" + _BannerCollection[j].BannerLink + "', '" + FetConstant.strTagetBlak + "', " + _Tb_Size.WidthSize + ", " + _Tb_Size.HightSize + ", " + _BannerLocationCollection[i].BannerLocationId + ", 0),";
                                }
                                else
                                {
                                    string strImage = FetConstant.strhrf + _BannerCollection[j].BannePath;
                                    str += "  new Array('" + strImage + "', '" + _BannerCollection[j].BannerLink + "', '" + FetConstant.strTagetBlak + "', " + _Tb_Size.WidthSize + ", " + _Tb_Size.HightSize + ", " + _BannerLocationCollection[i].BannerLocationId + ", 0)";
                                }
                            }
                        }

                    }
                }
                str += ");";
                str += "    </script>";
            }
        }
        return str;
    }
    #endregion Load adv home Center X new
    #endregion end Adv home
    
    #region Load banner Out
    #region banner out Home
    public static string LoadBannerOutHomeRight()
    {
        string str = "";
        Criteria cri = new Criteria();
        cri.add("[" + CatLocation._Table + "].[" + CatLocationColumns.Title + "]", FetConstant.HomeOutRinght, Condition.LIKE, Condition.AND);
        cri.add("[" + CatLocation._Table + "].[" + CatLocationColumns.Enable + "]", 1, Condition.LIKE, Condition.AND);
        CatLocationCollection _CatLocationCollection = CatLocationService.GetCatLocationListByParam(CatLocationColumns.LocationId, OrderDirection.ASC, cri.Criter);
        if (_CatLocationCollection.Count > 0)
        {
            Criteria crit = new Criteria();
            crit.add(BannerLocationColumns.CatLocationId, _CatLocationCollection[0].LocationId, Condition.EQUAL, Condition.AND);
            crit.add(BannerLocationColumns.Enable, 1, Condition.EQUAL, Condition.AND);
            BannerLocationCollection _BannerLocationCollection = BannerLocationService.GetBannerLocationListByParam("[" + BannerLocation._Table + "].[" + BannerLocationColumns.Order + "]", OrderDirection.ASC, crit.Criter);
            string width0 = "";
            string height0 = "";
            int countLocation = 0;
            int countBanner = 0;
            if (_BannerLocationCollection.Count > 0)
            {
                countLocation = int.Parse(_BannerLocationCollection.Count.ToString()) - 1;
                str += " <script type='text/javascript'>";
                str += "     var VarOutHomeRight = new Array(";
                for (int i = 0; i < _BannerLocationCollection.Count; i++)
                {
                    if (countLocation > i)
                    {
                        Tb_Size _Tb_Size = Tb_SizeService.GetTb_Size(_BannerLocationCollection[i].SizeID);
                        Criteria crite = new Criteria();
                        crite.add(BannerColumns.BannerLocationId, _BannerLocationCollection[i].BannerLocationId, Condition.EQUAL, Condition.AND);
                        crite.add(BannerColumns.StatusId, FetConstant._active, Condition.EQUAL, Condition.AND);
                        BannerCollection _BannerCollection = BannerService.GetBannerListByParam(BannerColumns.Viewed, OrderDirection.ASC, crite.Criter);

                        if (_BannerCollection.Count > 0)
                        {
                            for (int j = 0; j < _BannerCollection.Count; j++)
                            {
                                string strImage = FetConstant.strhrf + _BannerCollection[j].BannePath;
                                str += "  new Array('" + strImage + "', '" + _BannerCollection[j].BannerLink + "', '" + FetConstant.strTagetBlak + "', " + _Tb_Size.WidthSize + ", " + _Tb_Size.HightSize + ", " + _BannerLocationCollection[i].BannerLocationId + ", 0),";
                            }
                        }
                    }
                    else
                    {
                        Tb_Size _Tb_Size = Tb_SizeService.GetTb_Size(_BannerLocationCollection[i].SizeID);
                        width0 = _Tb_Size.WidthSize.ToString();
                        height0 = _Tb_Size.HightSize.ToString();
                        Criteria crite = new Criteria();
                        crite.add(BannerColumns.BannerLocationId, _BannerLocationCollection[i].BannerLocationId, Condition.EQUAL, Condition.AND);
                        crite.add(BannerColumns.StatusId, FetConstant._active, Condition.EQUAL, Condition.AND);
                        BannerCollection _BannerCollection = BannerService.GetBannerListByParam(BannerColumns.Viewed, OrderDirection.ASC, crite.Criter);
                        if (_BannerCollection.Count > 0)
                        {
                            countBanner = int.Parse(_BannerCollection.Count.ToString()) - 1;

                            for (int j = 0; j < _BannerCollection.Count; j++)
                            {
                                if (countBanner > j)
                                {
                                    string strImage = FetConstant.strhrf + _BannerCollection[j].BannePath;
                                    str += "  new Array('" + strImage + "', '" + _BannerCollection[j].BannerLink + "', '" + FetConstant.strTagetBlak + "', " + _Tb_Size.WidthSize + ", " + _Tb_Size.HightSize + ", " + _BannerLocationCollection[i].BannerLocationId + ", 0),";
                                }
                                else
                                {
                                    string strImage = FetConstant.strhrf + _BannerCollection[j].BannePath;
                                    str += "  new Array('" + strImage + "', '" + _BannerCollection[j].BannerLink + "', '" + FetConstant.strTagetBlak + "', " + _Tb_Size.WidthSize + ", " + _Tb_Size.HightSize + ", " + _BannerLocationCollection[i].BannerLocationId + ", 0)";
                                }
                            }
                        }

                    }
                }
                str += ");";
                str += "    </script>";
            }
        }
        return str;
    }
    public static string LoadBannerOutHomeLeft()
    {
        string str = "";
        Criteria cri = new Criteria();
        cri.add("[" + CatLocation._Table + "].[" + CatLocationColumns.Title + "]", FetConstant.HomeOutLeft, Condition.LIKE, Condition.AND);
        cri.add("[" + CatLocation._Table + "].[" + CatLocationColumns.Enable + "]", 1, Condition.LIKE, Condition.AND);
        CatLocationCollection _CatLocationCollection = CatLocationService.GetCatLocationListByParam(CatLocationColumns.LocationId, OrderDirection.ASC, cri.Criter);
        if (_CatLocationCollection.Count > 0)
        {
            Criteria crit = new Criteria();
            crit.add(BannerLocationColumns.CatLocationId, _CatLocationCollection[0].LocationId, Condition.EQUAL, Condition.AND);
            crit.add(BannerLocationColumns.Enable, 1, Condition.EQUAL, Condition.AND);
            BannerLocationCollection _BannerLocationCollection = BannerLocationService.GetBannerLocationListByParam("[" + BannerLocation._Table + "].[" + BannerLocationColumns.Order + "]", OrderDirection.ASC, crit.Criter);
            string width0 = "";
            string height0 = "";
            int countLocation = 0;
            int countBanner = 0;
            if (_BannerLocationCollection.Count > 0)
            {
                countLocation = int.Parse(_BannerLocationCollection.Count.ToString()) - 1;
                str += " <script type='text/javascript'>";
                str += "     var VarOutHomeLeft = new Array(";
                for (int i = 0; i < _BannerLocationCollection.Count; i++)
                {
                    if (countLocation > i)
                    {
                        Tb_Size _Tb_Size = Tb_SizeService.GetTb_Size(_BannerLocationCollection[i].SizeID);
                        Criteria crite = new Criteria();
                        crite.add(BannerColumns.BannerLocationId, _BannerLocationCollection[i].BannerLocationId, Condition.EQUAL, Condition.AND);
                        crite.add(BannerColumns.StatusId, FetConstant._active, Condition.EQUAL, Condition.AND);
                        BannerCollection _BannerCollection = BannerService.GetBannerListByParam(BannerColumns.Viewed, OrderDirection.ASC, crite.Criter);

                        if (_BannerCollection.Count > 0)
                        {
                            for (int j = 0; j < _BannerCollection.Count; j++)
                            {
                                string strImage = FetConstant.strhrf + _BannerCollection[j].BannePath;
                                str += "  new Array('" + strImage + "', '" + _BannerCollection[j].BannerLink + "', '" + FetConstant.strTagetBlak + "', " + _Tb_Size.WidthSize + ", " + _Tb_Size.HightSize + ", " + _BannerLocationCollection[i].BannerLocationId + ", 0),";
                            }
                        }
                    }
                    else
                    {
                        Tb_Size _Tb_Size = Tb_SizeService.GetTb_Size(_BannerLocationCollection[i].SizeID);
                        width0 = _Tb_Size.WidthSize.ToString();
                        height0 = _Tb_Size.HightSize.ToString();
                        Criteria crite = new Criteria();
                        crite.add(BannerColumns.BannerLocationId, _BannerLocationCollection[i].BannerLocationId, Condition.EQUAL, Condition.AND);
                        crite.add(BannerColumns.StatusId, FetConstant._active, Condition.EQUAL, Condition.AND);
                        BannerCollection _BannerCollection = BannerService.GetBannerListByParam(BannerColumns.Viewed, OrderDirection.ASC, crite.Criter);
                        if (_BannerCollection.Count > 0)
                        {
                            countBanner = int.Parse(_BannerCollection.Count.ToString()) - 1;

                            for (int j = 0; j < _BannerCollection.Count; j++)
                            {
                                if (countBanner > j)
                                {
                                    string strImage = FetConstant.strhrf + _BannerCollection[j].BannePath;
                                    str += "  new Array('" + strImage + "', '" + _BannerCollection[j].BannerLink + "', '" + FetConstant.strTagetBlak + "', " + _Tb_Size.WidthSize + ", " + _Tb_Size.HightSize + ", " + _BannerLocationCollection[i].BannerLocationId + ", 0),";
                                }
                                else
                                {
                                    string strImage = FetConstant.strhrf + _BannerCollection[j].BannePath;
                                    str += "  new Array('" + strImage + "', '" + _BannerCollection[j].BannerLink + "', '" + FetConstant.strTagetBlak + "', " + _Tb_Size.WidthSize + ", " + _Tb_Size.HightSize + ", " + _BannerLocationCollection[i].BannerLocationId + ", 0)";
                                }
                            }
                        }

                    }
                }
                str += ");";
                str += "    </script>";
            }
        }
        return str;
    }
    #endregion banner out home
    #region banner Out Product
    public static string LoadBannerOutProductRight()
    {
        string str = "";
        Criteria cri = new Criteria();
        cri.add("[" + CatLocation._Table + "].[" + CatLocationColumns.Title + "]", FetConstant.ProductOutRinght, Condition.LIKE, Condition.AND);
        cri.add("[" + CatLocation._Table + "].[" + CatLocationColumns.Enable + "]", 1, Condition.LIKE, Condition.AND);
        CatLocationCollection _CatLocationCollection = CatLocationService.GetCatLocationListByParam(CatLocationColumns.LocationId, OrderDirection.ASC, cri.Criter);
        if (_CatLocationCollection.Count > 0)
        {
            Criteria crit = new Criteria();
            crit.add(BannerLocationColumns.CatLocationId, _CatLocationCollection[0].LocationId, Condition.EQUAL, Condition.AND);
            crit.add(BannerLocationColumns.Enable, 1, Condition.EQUAL, Condition.AND);
            BannerLocationCollection _BannerLocationCollection = BannerLocationService.GetBannerLocationListByParam("[" + BannerLocation._Table + "].[" + BannerLocationColumns.Order + "]", OrderDirection.ASC, crit.Criter);
            string width0 = "";
            string height0 = "";
            int countLocation = 0;
            int countBanner = 0;
            if (_BannerLocationCollection.Count > 0)
            {
                countLocation = int.Parse(_BannerLocationCollection.Count.ToString()) - 1;
                str += " <script type='text/javascript'>";
                str += "     var VarProductOutRight = new Array(";
                for (int i = 0; i < _BannerLocationCollection.Count; i++)
                {
                    if (countLocation > i)
                    {
                        Tb_Size _Tb_Size = Tb_SizeService.GetTb_Size(_BannerLocationCollection[i].SizeID);
                        Criteria crite = new Criteria();
                        crite.add(BannerColumns.BannerLocationId, _BannerLocationCollection[i].BannerLocationId, Condition.EQUAL, Condition.AND);
                        crite.add(BannerColumns.StatusId, FetConstant._active, Condition.EQUAL, Condition.AND);
                        BannerCollection _BannerCollection = BannerService.GetBannerListByParam(BannerColumns.Viewed, OrderDirection.ASC, crite.Criter);

                        if (_BannerCollection.Count > 0)
                        {
                            for (int j = 0; j < _BannerCollection.Count; j++)
                            {
                                string strImage = FetConstant.strhrf + _BannerCollection[j].BannePath;
                                str += "  new Array('" + strImage + "', '" + _BannerCollection[j].BannerLink + "', '" + FetConstant.strTagetBlak + "', " + _Tb_Size.WidthSize + ", " + _Tb_Size.HightSize + ", " + _BannerLocationCollection[i].BannerLocationId + ", 0),";
                            }
                        }
                    }
                    else
                    {
                        Tb_Size _Tb_Size = Tb_SizeService.GetTb_Size(_BannerLocationCollection[i].SizeID);
                        width0 = _Tb_Size.WidthSize.ToString();
                        height0 = _Tb_Size.HightSize.ToString();
                        Criteria crite = new Criteria();
                        crite.add(BannerColumns.BannerLocationId, _BannerLocationCollection[i].BannerLocationId, Condition.EQUAL, Condition.AND);
                        crite.add(BannerColumns.StatusId, FetConstant._active, Condition.EQUAL, Condition.AND);
                        BannerCollection _BannerCollection = BannerService.GetBannerListByParam(BannerColumns.Viewed, OrderDirection.ASC, crite.Criter);
                        if (_BannerCollection.Count > 0)
                        {
                            countBanner = int.Parse(_BannerCollection.Count.ToString()) - 1;

                            for (int j = 0; j < _BannerCollection.Count; j++)
                            {
                                if (countBanner > j)
                                {
                                    string strImage = FetConstant.strhrf + _BannerCollection[j].BannePath;
                                    str += "  new Array('" + strImage + "', '" + _BannerCollection[j].BannerLink + "', '" + FetConstant.strTagetBlak + "', " + _Tb_Size.WidthSize + ", " + _Tb_Size.HightSize + ", " + _BannerLocationCollection[i].BannerLocationId + ", 0),";
                                }
                                else
                                {
                                    string strImage = FetConstant.strhrf + _BannerCollection[j].BannePath;
                                    str += "  new Array('" + strImage + "', '" + _BannerCollection[j].BannerLink + "', '" + FetConstant.strTagetBlak + "', " + _Tb_Size.WidthSize + ", " + _Tb_Size.HightSize + ", " + _BannerLocationCollection[i].BannerLocationId + ", 0)";
                                }
                            }
                        }

                    }
                }
                str += ");";
                str += "    </script>";
            }
        }
        return str;
    }
    public static string LoadBannerOutProductLeft()
    {
        string str = "";
        Criteria cri = new Criteria();
        cri.add("[" + CatLocation._Table + "].[" + CatLocationColumns.Title + "]", FetConstant.ProductOutLeft, Condition.LIKE, Condition.AND);
        cri.add("[" + CatLocation._Table + "].[" + CatLocationColumns.Enable + "]", 1, Condition.LIKE, Condition.AND);
        CatLocationCollection _CatLocationCollection = CatLocationService.GetCatLocationListByParam(CatLocationColumns.LocationId, OrderDirection.ASC, cri.Criter);
        if (_CatLocationCollection.Count > 0)
        {
            Criteria crit = new Criteria();
            crit.add(BannerLocationColumns.CatLocationId, _CatLocationCollection[0].LocationId, Condition.EQUAL, Condition.AND);
            crit.add(BannerLocationColumns.Enable, 1, Condition.EQUAL, Condition.AND);
            BannerLocationCollection _BannerLocationCollection = BannerLocationService.GetBannerLocationListByParam("[" + BannerLocation._Table + "].[" + BannerLocationColumns.Order + "]", OrderDirection.ASC, crit.Criter);
            string width0 = "";
            string height0 = "";
            int countLocation = 0;
            int countBanner = 0;
            if (_BannerLocationCollection.Count > 0)
            {
                countLocation = int.Parse(_BannerLocationCollection.Count.ToString()) - 1;
                str += " <script type='text/javascript'>";
                str += "     var VarProductOutLeft = new Array(";
                for (int i = 0; i < _BannerLocationCollection.Count; i++)
                {
                    if (countLocation > i)
                    {
                        Tb_Size _Tb_Size = Tb_SizeService.GetTb_Size(_BannerLocationCollection[i].SizeID);
                        Criteria crite = new Criteria();
                        crite.add(BannerColumns.BannerLocationId, _BannerLocationCollection[i].BannerLocationId, Condition.EQUAL, Condition.AND);
                        crite.add(BannerColumns.StatusId, FetConstant._active, Condition.EQUAL, Condition.AND);
                        BannerCollection _BannerCollection = BannerService.GetBannerListByParam(BannerColumns.Viewed, OrderDirection.ASC, crite.Criter);

                        if (_BannerCollection.Count > 0)
                        {
                            for (int j = 0; j < _BannerCollection.Count; j++)
                            {
                                string strImage = FetConstant.strhrf + _BannerCollection[j].BannePath;
                                str += "  new Array('" + strImage + "', '" + _BannerCollection[j].BannerLink + "', '" + FetConstant.strTagetBlak + "', " + _Tb_Size.WidthSize + ", " + _Tb_Size.HightSize + ", " + _BannerLocationCollection[i].BannerLocationId + ", 0),";
                            }
                        }
                    }
                    else
                    {
                        Tb_Size _Tb_Size = Tb_SizeService.GetTb_Size(_BannerLocationCollection[i].SizeID);
                        width0 = _Tb_Size.WidthSize.ToString();
                        height0 = _Tb_Size.HightSize.ToString();
                        Criteria crite = new Criteria();
                        crite.add(BannerColumns.BannerLocationId, _BannerLocationCollection[i].BannerLocationId, Condition.EQUAL, Condition.AND);
                        crite.add(BannerColumns.StatusId, FetConstant._active, Condition.EQUAL, Condition.AND);
                        BannerCollection _BannerCollection = BannerService.GetBannerListByParam(BannerColumns.Viewed, OrderDirection.ASC, crite.Criter);
                        if (_BannerCollection.Count > 0)
                        {
                            countBanner = int.Parse(_BannerCollection.Count.ToString()) - 1;

                            for (int j = 0; j < _BannerCollection.Count; j++)
                            {
                                if (countBanner > j)
                                {
                                    string strImage = FetConstant.strhrf + _BannerCollection[j].BannePath;
                                    str += "  new Array('" + strImage + "', '" + _BannerCollection[j].BannerLink + "', '" + FetConstant.strTagetBlak + "', " + _Tb_Size.WidthSize + ", " + _Tb_Size.HightSize + ", " + _BannerLocationCollection[i].BannerLocationId + ", 0),";
                                }
                                else
                                {
                                    string strImage = FetConstant.strhrf + _BannerCollection[j].BannePath;
                                    str += "  new Array('" + strImage + "', '" + _BannerCollection[j].BannerLink + "', '" + FetConstant.strTagetBlak + "', " + _Tb_Size.WidthSize + ", " + _Tb_Size.HightSize + ", " + _BannerLocationCollection[i].BannerLocationId + ", 0)";
                                }
                            }
                        }

                    }
                }
                str += ");";
                str += "    </script>";
            }
        }
        return str;
    }
    #endregion Banner Out Product
    #region Banner Out Member 
    public static string LoadBannerMemberOutRight()
    {
        string str = "";
        Criteria cri = new Criteria();
        cri.add("[" + CatLocation._Table + "].[" + CatLocationColumns.Title + "]", FetConstant.MemberOutRinght, Condition.LIKE, Condition.AND);
        cri.add("[" + CatLocation._Table + "].[" + CatLocationColumns.Enable + "]", 1, Condition.LIKE, Condition.AND);
        CatLocationCollection _CatLocationCollection = CatLocationService.GetCatLocationListByParam(CatLocationColumns.LocationId, OrderDirection.ASC, cri.Criter);
        if (_CatLocationCollection.Count > 0)
        {
            Criteria crit = new Criteria();
            crit.add(BannerLocationColumns.CatLocationId, _CatLocationCollection[0].LocationId, Condition.EQUAL, Condition.AND);
            crit.add(BannerLocationColumns.Enable, 1, Condition.EQUAL, Condition.AND);
            BannerLocationCollection _BannerLocationCollection = BannerLocationService.GetBannerLocationListByParam("[" + BannerLocation._Table + "].[" + BannerLocationColumns.Order + "]", OrderDirection.ASC, crit.Criter);
            string width0 = "";
            string height0 = "";
            int countLocation = 0;
            int countBanner = 0;
            if (_BannerLocationCollection.Count > 0)
            {
                countLocation = int.Parse(_BannerLocationCollection.Count.ToString()) - 1;
                str += " <script type='text/javascript'>";
                str += "     var VarMemberOutRight = new Array(";
                for (int i = 0; i < _BannerLocationCollection.Count; i++)
                {
                    if (countLocation > i)
                    {
                        Tb_Size _Tb_Size = Tb_SizeService.GetTb_Size(_BannerLocationCollection[i].SizeID);
                        Criteria crite = new Criteria();
                        crite.add(BannerColumns.BannerLocationId, _BannerLocationCollection[i].BannerLocationId, Condition.EQUAL, Condition.AND);
                        crite.add(BannerColumns.StatusId, FetConstant._active, Condition.EQUAL, Condition.AND);
                        BannerCollection _BannerCollection = BannerService.GetBannerListByParam(BannerColumns.Viewed, OrderDirection.ASC, crite.Criter);

                        if (_BannerCollection.Count > 0)
                        {
                            for (int j = 0; j < _BannerCollection.Count; j++)
                            {
                                string strImage = FetConstant.strhrf + _BannerCollection[j].BannePath;
                                str += "  new Array('" + strImage + "', '" + _BannerCollection[j].BannerLink + "', '" + FetConstant.strTagetBlak + "', " + _Tb_Size.WidthSize + ", " + _Tb_Size.HightSize + ", " + _BannerLocationCollection[i].BannerLocationId + ", 0),";
                            }
                        }
                    }
                    else
                    {
                        Tb_Size _Tb_Size = Tb_SizeService.GetTb_Size(_BannerLocationCollection[i].SizeID);
                        width0 = _Tb_Size.WidthSize.ToString();
                        height0 = _Tb_Size.HightSize.ToString();
                        Criteria crite = new Criteria();
                        crite.add(BannerColumns.BannerLocationId, _BannerLocationCollection[i].BannerLocationId, Condition.EQUAL, Condition.AND);
                        crite.add(BannerColumns.StatusId, FetConstant._active, Condition.EQUAL, Condition.AND);
                        BannerCollection _BannerCollection = BannerService.GetBannerListByParam(BannerColumns.Viewed, OrderDirection.ASC, crite.Criter);
                        if (_BannerCollection.Count > 0)
                        {
                            countBanner = int.Parse(_BannerCollection.Count.ToString()) - 1;

                            for (int j = 0; j < _BannerCollection.Count; j++)
                            {
                                if (countBanner > j)
                                {
                                    string strImage = FetConstant.strhrf + _BannerCollection[j].BannePath;
                                    str += "  new Array('" + strImage + "', '" + _BannerCollection[j].BannerLink + "', '" + FetConstant.strTagetBlak + "', " + _Tb_Size.WidthSize + ", " + _Tb_Size.HightSize + ", " + _BannerLocationCollection[i].BannerLocationId + ", 0),";
                                }
                                else
                                {
                                    string strImage = FetConstant.strhrf + _BannerCollection[j].BannePath;
                                    str += "  new Array('" + strImage + "', '" + _BannerCollection[j].BannerLink + "', '" + FetConstant.strTagetBlak + "', " + _Tb_Size.WidthSize + ", " + _Tb_Size.HightSize + ", " + _BannerLocationCollection[i].BannerLocationId + ", 0)";
                                }
                            }
                        }

                    }
                }
                str += ");";
                str += "    </script>";
            }
        }
        return str;
    }
    public static string LoadBannerMemberOutLeft()
    {
        string str = "";
        Criteria cri = new Criteria();
        cri.add("[" + CatLocation._Table + "].[" + CatLocationColumns.Title + "]", FetConstant.MemberOutLeft, Condition.LIKE, Condition.AND);
        cri.add("[" + CatLocation._Table + "].[" + CatLocationColumns.Enable + "]", 1, Condition.LIKE, Condition.AND);
        CatLocationCollection _CatLocationCollection = CatLocationService.GetCatLocationListByParam(CatLocationColumns.LocationId, OrderDirection.ASC, cri.Criter);
        if (_CatLocationCollection.Count > 0)
        {
            Criteria crit = new Criteria();
            crit.add(BannerLocationColumns.CatLocationId, _CatLocationCollection[0].LocationId, Condition.EQUAL, Condition.AND);
            crit.add(BannerLocationColumns.Enable, 1, Condition.EQUAL, Condition.AND);
            BannerLocationCollection _BannerLocationCollection = BannerLocationService.GetBannerLocationListByParam("[" + BannerLocation._Table + "].[" + BannerLocationColumns.Order + "]", OrderDirection.ASC, crit.Criter);
            string width0 = "";
            string height0 = "";
            int countLocation = 0;
            int countBanner = 0;
            if (_BannerLocationCollection.Count > 0)
            {
                countLocation = int.Parse(_BannerLocationCollection.Count.ToString()) - 1;
                str += " <script type='text/javascript'>";
                str += "     var VarMemberOutLeft = new Array(";
                for (int i = 0; i < _BannerLocationCollection.Count; i++)
                {
                    if (countLocation > i)
                    {
                        Tb_Size _Tb_Size = Tb_SizeService.GetTb_Size(_BannerLocationCollection[i].SizeID);
                        Criteria crite = new Criteria();
                        crite.add(BannerColumns.BannerLocationId, _BannerLocationCollection[i].BannerLocationId, Condition.EQUAL, Condition.AND);
                        crite.add(BannerColumns.StatusId, FetConstant._active, Condition.EQUAL, Condition.AND);
                        BannerCollection _BannerCollection = BannerService.GetBannerListByParam(BannerColumns.Viewed, OrderDirection.ASC, crite.Criter);

                        if (_BannerCollection.Count > 0)
                        {
                            for (int j = 0; j < _BannerCollection.Count; j++)
                            {
                                string strImage = FetConstant.strhrf + _BannerCollection[j].BannePath;
                                str += "  new Array('" + strImage + "', '" + _BannerCollection[j].BannerLink + "', '" + FetConstant.strTagetBlak + "', " + _Tb_Size.WidthSize + ", " + _Tb_Size.HightSize + ", " + _BannerLocationCollection[i].BannerLocationId + ", 0),";
                            }
                        }
                    }
                    else
                    {
                        Tb_Size _Tb_Size = Tb_SizeService.GetTb_Size(_BannerLocationCollection[i].SizeID);
                        width0 = _Tb_Size.WidthSize.ToString();
                        height0 = _Tb_Size.HightSize.ToString();
                        Criteria crite = new Criteria();
                        crite.add(BannerColumns.BannerLocationId, _BannerLocationCollection[i].BannerLocationId, Condition.EQUAL, Condition.AND);
                        crite.add(BannerColumns.StatusId, FetConstant._active, Condition.EQUAL, Condition.AND);
                        BannerCollection _BannerCollection = BannerService.GetBannerListByParam(BannerColumns.Viewed, OrderDirection.ASC, crite.Criter);
                        if (_BannerCollection.Count > 0)
                        {
                            countBanner = int.Parse(_BannerCollection.Count.ToString()) - 1;

                            for (int j = 0; j < _BannerCollection.Count; j++)
                            {
                                if (countBanner > j)
                                {
                                    string strImage = FetConstant.strhrf + _BannerCollection[j].BannePath;
                                    str += "  new Array('" + strImage + "', '" + _BannerCollection[j].BannerLink + "', '" + FetConstant.strTagetBlak + "', " + _Tb_Size.WidthSize + ", " + _Tb_Size.HightSize + ", " + _BannerLocationCollection[i].BannerLocationId + ", 0),";
                                }
                                else
                                {
                                    string strImage = FetConstant.strhrf + _BannerCollection[j].BannePath;
                                    str += "  new Array('" + strImage + "', '" + _BannerCollection[j].BannerLink + "', '" + FetConstant.strTagetBlak + "', " + _Tb_Size.WidthSize + ", " + _Tb_Size.HightSize + ", " + _BannerLocationCollection[i].BannerLocationId + ", 0)";
                                }
                            }
                        }

                    }
                }
                str += ");";
                str += "    </script>";
            }
        }
        return str;
    }
    #endregion Banner Out Member

    #endregion Load banner Out
    #region start adv Centre
    public static string LoadCentreRight()
    {
        string str = "";
        Criteria cri = new Criteria();
        cri.add("[" + CatLocation._Table + "].[" + CatLocationColumns.Title + "]", FetConstant.CentreRight, Condition.LIKE, Condition.AND);
        cri.add("[" + CatLocation._Table + "].[" + CatLocationColumns.Enable + "]", 1, Condition.LIKE, Condition.AND);
        CatLocationCollection _CatLocationCollection = CatLocationService.GetCatLocationListByParam(CatLocationColumns.LocationId, OrderDirection.ASC, cri.Criter);
        if (_CatLocationCollection.Count > 0)
        {
            Criteria crit = new Criteria();
            crit.add(BannerLocationColumns.CatLocationId, _CatLocationCollection[0].LocationId, Condition.EQUAL, Condition.AND);
            crit.add(BannerLocationColumns.Enable, 1, Condition.EQUAL, Condition.AND);
            BannerLocationCollection _BannerLocationCollection = BannerLocationService.GetBannerLocationListByParam("[" + BannerLocation._Table + "].[" + BannerLocationColumns.Order + "]", OrderDirection.ASC, crit.Criter);
            string width0 = "";
            string height0 = "";
            int countLocation = 0;
            int countBanner = 0;
            if (_BannerLocationCollection.Count > 0)
            {
                countLocation = int.Parse(_BannerLocationCollection.Count.ToString()) - 1;
                str += " <script type='text/javascript'>";
                str += "     var VarCentreRight = new Array(";
                for (int i = 0; i < _BannerLocationCollection.Count; i++)
                {
                    if (countLocation > i)
                    {
                        Tb_Size _Tb_Size = Tb_SizeService.GetTb_Size(_BannerLocationCollection[i].SizeID);
                        Criteria crite = new Criteria();
                        crite.add(BannerColumns.BannerLocationId, _BannerLocationCollection[i].BannerLocationId, Condition.EQUAL, Condition.AND);
                        crite.add(BannerColumns.StatusId, FetConstant._active, Condition.EQUAL, Condition.AND);
                        BannerCollection _BannerCollection = BannerService.GetBannerListByParam(BannerColumns.Viewed, OrderDirection.ASC, crite.Criter);

                        if (_BannerCollection.Count > 0)
                        {
                            for (int j = 0; j < _BannerCollection.Count; j++)
                            {
                                string strImage = FetConstant.strhrf + _BannerCollection[j].BannePath;
                                str += "  new Array('" + strImage + "', '" + _BannerCollection[j].BannerLink + "', '" + FetConstant.strTagetBlak + "', " + _Tb_Size.WidthSize + ", " + _Tb_Size.HightSize + ", " + _BannerLocationCollection[i].BannerLocationId + ", 0),";
                            }
                        }
                    }
                    else
                    {
                        Tb_Size _Tb_Size = Tb_SizeService.GetTb_Size(_BannerLocationCollection[i].SizeID);
                        width0 = _Tb_Size.WidthSize.ToString();
                        height0 = _Tb_Size.HightSize.ToString();
                        Criteria crite = new Criteria();
                        crite.add(BannerColumns.BannerLocationId, _BannerLocationCollection[i].BannerLocationId, Condition.EQUAL, Condition.AND);
                        crite.add(BannerColumns.StatusId, FetConstant._active, Condition.EQUAL, Condition.AND);
                        BannerCollection _BannerCollection = BannerService.GetBannerListByParam(BannerColumns.Viewed, OrderDirection.ASC, crite.Criter);
                        if (_BannerCollection.Count > 0)
                        {
                            countBanner = int.Parse(_BannerCollection.Count.ToString()) - 1;

                            for (int j = 0; j < _BannerCollection.Count; j++)
                            {
                                if (countBanner > j)
                                {
                                    string strImage = FetConstant.strhrf + _BannerCollection[j].BannePath;
                                    str += "  new Array('" + strImage + "', '" + _BannerCollection[j].BannerLink + "', '" + FetConstant.strTagetBlak + "', " + _Tb_Size.WidthSize + ", " + _Tb_Size.HightSize + ", " + _BannerLocationCollection[i].BannerLocationId + ", 0),";
                                }
                                else
                                {
                                    string strImage = FetConstant.strhrf + _BannerCollection[j].BannePath;
                                    str += "  new Array('" + strImage + "', '" + _BannerCollection[j].BannerLink + "', '" + FetConstant.strTagetBlak + "', " + _Tb_Size.WidthSize + ", " + _Tb_Size.HightSize + ", " + _BannerLocationCollection[i].BannerLocationId + ", 0)";
                                }
                            }
                        }
                    }
                }
                str += ");";
                str += "    </script>";
            }
        }
        return str;
    }
    #endregion end adv Centre
    #region start adv Event
    public static string LoadEventRight()
    {
        string str = "";
        Criteria cri = new Criteria();
        cri.add("[" + CatLocation._Table + "].[" + CatLocationColumns.Title + "]", FetConstant.EventRight, Condition.LIKE, Condition.AND);
        cri.add("[" + CatLocation._Table + "].[" + CatLocationColumns.Enable + "]", 1, Condition.LIKE, Condition.AND);
        CatLocationCollection _CatLocationCollection = CatLocationService.GetCatLocationListByParam(CatLocationColumns.LocationId, OrderDirection.ASC, cri.Criter);
        if (_CatLocationCollection.Count > 0)
        {
            Criteria crit = new Criteria();
            crit.add(BannerLocationColumns.CatLocationId, _CatLocationCollection[0].LocationId, Condition.EQUAL, Condition.AND);
            crit.add(BannerLocationColumns.Enable, 1, Condition.EQUAL, Condition.AND);
            BannerLocationCollection _BannerLocationCollection = BannerLocationService.GetBannerLocationListByParam("[" + BannerLocation._Table + "].[" + BannerLocationColumns.Order + "]", OrderDirection.ASC, crit.Criter);
            string width0 = "";
            string height0 = "";
            int countLocation = 0;
            int countBanner = 0;
            if (_BannerLocationCollection.Count > 0)
            {
                countLocation = int.Parse(_BannerLocationCollection.Count.ToString()) - 1;
                str += " <script type='text/javascript'>";
                str += "     var VarEventRight = new Array(";
                for (int i = 0; i < _BannerLocationCollection.Count; i++)
                {
                    if (countLocation > i)
                    {
                        Tb_Size _Tb_Size = Tb_SizeService.GetTb_Size(_BannerLocationCollection[i].SizeID);
                        Criteria crite = new Criteria();
                        crite.add(BannerColumns.BannerLocationId, _BannerLocationCollection[i].BannerLocationId, Condition.EQUAL, Condition.AND);
                        crite.add(BannerColumns.StatusId, FetConstant._active, Condition.EQUAL, Condition.AND);
                        BannerCollection _BannerCollection = BannerService.GetBannerListByParam(BannerColumns.Viewed, OrderDirection.ASC, crite.Criter);

                        if (_BannerCollection.Count > 0)
                        {
                            for (int j = 0; j < _BannerCollection.Count; j++)
                            {
                                string strImage = FetConstant.strhrf + _BannerCollection[j].BannePath;
                                str += "  new Array('" + strImage + "', '" + _BannerCollection[j].BannerLink + "', '" + FetConstant.strTagetBlak + "', " + _Tb_Size.WidthSize + ", " + _Tb_Size.HightSize + ", " + _BannerLocationCollection[i].BannerLocationId + ", 0),";
                            }
                        }
                    }
                    else
                    {
                        Tb_Size _Tb_Size = Tb_SizeService.GetTb_Size(_BannerLocationCollection[i].SizeID);
                        width0 = _Tb_Size.WidthSize.ToString();
                        height0 = _Tb_Size.HightSize.ToString();
                        Criteria crite = new Criteria();
                        crite.add(BannerColumns.BannerLocationId, _BannerLocationCollection[i].BannerLocationId, Condition.EQUAL, Condition.AND);
                        crite.add(BannerColumns.StatusId, FetConstant._active, Condition.EQUAL, Condition.AND);
                        BannerCollection _BannerCollection = BannerService.GetBannerListByParam(BannerColumns.Viewed, OrderDirection.ASC, crite.Criter);
                        if (_BannerCollection.Count > 0)
                        {
                            countBanner = int.Parse(_BannerCollection.Count.ToString()) - 1;

                            for (int j = 0; j < _BannerCollection.Count; j++)
                            {
                                if (countBanner > j)
                                {
                                    string strImage = FetConstant.strhrf + _BannerCollection[j].BannePath;
                                    str += "  new Array('" + strImage + "', '" + _BannerCollection[j].BannerLink + "', '" + FetConstant.strTagetBlak + "', " + _Tb_Size.WidthSize + ", " + _Tb_Size.HightSize + ", " + _BannerLocationCollection[i].BannerLocationId + ", 0),";
                                }
                                else
                                {
                                    string strImage = FetConstant.strhrf + _BannerCollection[j].BannePath;
                                    str += "  new Array('" + strImage + "', '" + _BannerCollection[j].BannerLink + "', '" + FetConstant.strTagetBlak + "', " + _Tb_Size.WidthSize + ", " + _Tb_Size.HightSize + ", " + _BannerLocationCollection[i].BannerLocationId + ", 0)";
                                }
                            }
                        }
                    }
                }
                str += ");";
                str += "    </script>";
            }
        }
        return str;
    }
    #endregion end adv Event
    #region start adv Classifiel
    public static string LoadClassifielRight()
    {
        string str = "";
        Criteria cri = new Criteria();
        cri.add("[" + CatLocation._Table + "].[" + CatLocationColumns.Title + "]", FetConstant.ClassifileRight, Condition.LIKE, Condition.AND);
        cri.add("[" + CatLocation._Table + "].[" + CatLocationColumns.Enable + "]", 1, Condition.LIKE, Condition.AND);
        CatLocationCollection _CatLocationCollection = CatLocationService.GetCatLocationListByParam(CatLocationColumns.LocationId, OrderDirection.ASC, cri.Criter);
        if (_CatLocationCollection.Count > 0)
        {
            Criteria crit = new Criteria();
            crit.add(BannerLocationColumns.CatLocationId, _CatLocationCollection[0].LocationId, Condition.EQUAL, Condition.AND);
            crit.add(BannerLocationColumns.Enable, 1, Condition.EQUAL, Condition.AND);
            BannerLocationCollection _BannerLocationCollection = BannerLocationService.GetBannerLocationListByParam("[" + BannerLocation._Table + "].[" + BannerLocationColumns.Order + "]", OrderDirection.ASC, crit.Criter);
            string width0 = "";
            string height0 = "";
            int countLocation = 0;
            int countBanner = 0;
            if (_BannerLocationCollection.Count > 0)
            {
                countLocation = int.Parse(_BannerLocationCollection.Count.ToString()) - 1;
                str += " <script type='text/javascript'>";
                str += "     var VarClassifielRight = new Array(";
                for (int i = 0; i < _BannerLocationCollection.Count; i++)
                {
                    if (countLocation > i)
                    {
                        Tb_Size _Tb_Size = Tb_SizeService.GetTb_Size(_BannerLocationCollection[i].SizeID);
                        Criteria crite = new Criteria();
                        crite.add(BannerColumns.BannerLocationId, _BannerLocationCollection[i].BannerLocationId, Condition.EQUAL, Condition.AND);
                        crite.add(BannerColumns.StatusId, FetConstant._active, Condition.EQUAL, Condition.AND);
                        BannerCollection _BannerCollection = BannerService.GetBannerListByParam(BannerColumns.Viewed, OrderDirection.ASC, crite.Criter);

                        if (_BannerCollection.Count > 0)
                        {
                            for (int j = 0; j < _BannerCollection.Count; j++)
                            {
                                string strImage = FetConstant.strhrf + _BannerCollection[j].BannePath;
                                str += "  new Array('" + strImage + "', '" + _BannerCollection[j].BannerLink + "', '" + FetConstant.strTagetBlak + "', " + _Tb_Size.WidthSize + ", " + _Tb_Size.HightSize + ", " + _BannerLocationCollection[i].BannerLocationId + ", 0),";
                            }
                        }
                    }
                    else
                    {
                        Tb_Size _Tb_Size = Tb_SizeService.GetTb_Size(_BannerLocationCollection[i].SizeID);
                        width0 = _Tb_Size.WidthSize.ToString();
                        height0 = _Tb_Size.HightSize.ToString();
                        Criteria crite = new Criteria();
                        crite.add(BannerColumns.BannerLocationId, _BannerLocationCollection[i].BannerLocationId, Condition.EQUAL, Condition.AND);
                        crite.add(BannerColumns.StatusId, FetConstant._active, Condition.EQUAL, Condition.AND);
                        BannerCollection _BannerCollection = BannerService.GetBannerListByParam(BannerColumns.Viewed, OrderDirection.ASC, crite.Criter);
                        if (_BannerCollection.Count > 0)
                        {
                            countBanner = int.Parse(_BannerCollection.Count.ToString()) - 1;

                            for (int j = 0; j < _BannerCollection.Count; j++)
                            {
                                if (countBanner > j)
                                {
                                    string strImage = FetConstant.strhrf + _BannerCollection[j].BannePath;
                                    str += "  new Array('" + strImage + "', '" + _BannerCollection[j].BannerLink + "', '" + FetConstant.strTagetBlak + "', " + _Tb_Size.WidthSize + ", " + _Tb_Size.HightSize + ", " + _BannerLocationCollection[i].BannerLocationId + ", 0),";
                                }
                                else
                                {
                                    string strImage = FetConstant.strhrf + _BannerCollection[j].BannePath;
                                    str += "  new Array('" + strImage + "', '" + _BannerCollection[j].BannerLink + "', '" + FetConstant.strTagetBlak + "', " + _Tb_Size.WidthSize + ", " + _Tb_Size.HightSize + ", " + _BannerLocationCollection[i].BannerLocationId + ", 0)";
                                }
                            }
                        }
                    }
                }
                str += ");";
                str += "    </script>";
            }
        }
        return str;
    }
    public static string LoadClassifielCenter()
    {
        string str = "";
        Criteria cri = new Criteria();
        cri.add("[" + CatLocation._Table + "].[" + CatLocationColumns.Title + "]", FetConstant.ClassifileCentre, Condition.LIKE, Condition.AND);
        cri.add("[" + CatLocation._Table + "].[" + CatLocationColumns.Enable + "]", 1, Condition.LIKE, Condition.AND);
        CatLocationCollection _CatLocationCollection = CatLocationService.GetCatLocationListByParam(CatLocationColumns.LocationId, OrderDirection.ASC, cri.Criter);
        if (_CatLocationCollection.Count > 0)
        {
            Criteria crit = new Criteria();
            crit.add(BannerLocationColumns.CatLocationId, _CatLocationCollection[0].LocationId, Condition.EQUAL, Condition.AND);
            crit.add(BannerLocationColumns.Enable, 1, Condition.EQUAL, Condition.AND);
            BannerLocationCollection _BannerLocationCollection = BannerLocationService.GetBannerLocationListByParam("[" + BannerLocation._Table + "].[" + BannerLocationColumns.Order + "]", OrderDirection.ASC, crit.Criter);
            string width0 = "";
            string height0 = "";
            int countLocation = 0;
            int countBanner = 0;
            if (_BannerLocationCollection.Count > 0)
            {
                countLocation = int.Parse(_BannerLocationCollection.Count.ToString()) - 1;
                str += " <script type='text/javascript'>";
                str += "     var VarClassifielCenter = new Array(";
                for (int i = 0; i < _BannerLocationCollection.Count; i++)
                {
                    if (countLocation > i)
                    {
                        Tb_Size _Tb_Size = Tb_SizeService.GetTb_Size(_BannerLocationCollection[i].SizeID);
                        Criteria crite = new Criteria();
                        crite.add(BannerColumns.BannerLocationId, _BannerLocationCollection[i].BannerLocationId, Condition.EQUAL, Condition.AND);
                        crite.add(BannerColumns.StatusId, FetConstant._active, Condition.EQUAL, Condition.AND);
                        BannerCollection _BannerCollection = BannerService.GetBannerListByParam(BannerColumns.Viewed, OrderDirection.ASC, crite.Criter);

                        if (_BannerCollection.Count > 0)
                        {
                            for (int j = 0; j < _BannerCollection.Count; j++)
                            {
                                string strImage = FetConstant.strhrf + _BannerCollection[j].BannePath;
                                str += "  new Array('" + strImage + "', '" + _BannerCollection[j].BannerLink + "', '" + FetConstant.strTagetBlak + "', " + _Tb_Size.WidthSize + ", " + _Tb_Size.HightSize + ", " + _BannerLocationCollection[i].BannerLocationId + ", 0),";
                            }
                        }
                    }
                    else
                    {
                        Tb_Size _Tb_Size = Tb_SizeService.GetTb_Size(_BannerLocationCollection[i].SizeID);
                        width0 = _Tb_Size.WidthSize.ToString();
                        height0 = _Tb_Size.HightSize.ToString();
                        Criteria crite = new Criteria();
                        crite.add(BannerColumns.BannerLocationId, _BannerLocationCollection[i].BannerLocationId, Condition.EQUAL, Condition.AND);
                        crite.add(BannerColumns.StatusId, FetConstant._active, Condition.EQUAL, Condition.AND);
                        BannerCollection _BannerCollection = BannerService.GetBannerListByParam(BannerColumns.Viewed, OrderDirection.ASC, crite.Criter);
                        if (_BannerCollection.Count > 0)
                        {
                            countBanner = int.Parse(_BannerCollection.Count.ToString()) - 1;

                            for (int j = 0; j < _BannerCollection.Count; j++)
                            {
                                if (countBanner > j)
                                {
                                    string strImage = FetConstant.strhrf + _BannerCollection[j].BannePath;
                                    str += "  new Array('" + strImage + "', '" + _BannerCollection[j].BannerLink + "', '" + FetConstant.strTagetBlak + "', " + _Tb_Size.WidthSize + ", " + _Tb_Size.HightSize + ", " + _BannerLocationCollection[i].BannerLocationId + ", 0),";
                                }
                                else
                                {
                                    string strImage = FetConstant.strhrf + _BannerCollection[j].BannePath;
                                    str += "  new Array('" + strImage + "', '" + _BannerCollection[j].BannerLink + "', '" + FetConstant.strTagetBlak + "', " + _Tb_Size.WidthSize + ", " + _Tb_Size.HightSize + ", " + _BannerLocationCollection[i].BannerLocationId + ", 0)";
                                }
                            }
                        }
                    }
                }
                str += ");";
                str += "    </script>";
            }
        }
        return str;
    }
    #endregion end adv Event
    #region start adv Brand
    public static string LoadBrandRight()
    {
        string str = "";
        Criteria cri = new Criteria();
        cri.add("[" + CatLocation._Table + "].[" + CatLocationColumns.Title + "]", FetConstant.BrandRight, Condition.LIKE, Condition.AND);
        cri.add("[" + CatLocation._Table + "].[" + CatLocationColumns.Enable + "]", 1, Condition.LIKE, Condition.AND);
        CatLocationCollection _CatLocationCollection = CatLocationService.GetCatLocationListByParam(CatLocationColumns.LocationId, OrderDirection.ASC, cri.Criter);
        if (_CatLocationCollection.Count > 0)
        {
            Criteria crit = new Criteria();
            crit.add(BannerLocationColumns.CatLocationId, _CatLocationCollection[0].LocationId, Condition.EQUAL, Condition.AND);
            crit.add(BannerLocationColumns.Enable, 1, Condition.EQUAL, Condition.AND);
            BannerLocationCollection _BannerLocationCollection = BannerLocationService.GetBannerLocationListByParam("[" + BannerLocation._Table + "].[" + BannerLocationColumns.Order + "]", OrderDirection.ASC, crit.Criter);
            string width0 = "";
            string height0 = "";
            int countLocation = 0;
            int countBanner = 0;
            if (_BannerLocationCollection.Count > 0)
            {
                countLocation = int.Parse(_BannerLocationCollection.Count.ToString()) - 1;
                str += " <script type='text/javascript'>";
                str += "     var VarBrandRight = new Array(";
                for (int i = 0; i < _BannerLocationCollection.Count; i++)
                {
                    if (countLocation > i)
                    {
                        Tb_Size _Tb_Size = Tb_SizeService.GetTb_Size(_BannerLocationCollection[i].SizeID);
                        Criteria crite = new Criteria();
                        crite.add(BannerColumns.BannerLocationId, _BannerLocationCollection[i].BannerLocationId, Condition.EQUAL, Condition.AND);
                        crite.add(BannerColumns.StatusId, FetConstant._active, Condition.EQUAL, Condition.AND);
                        BannerCollection _BannerCollection = BannerService.GetBannerListByParam(BannerColumns.Viewed, OrderDirection.ASC, crite.Criter);

                        if (_BannerCollection.Count > 0)
                        {
                            for (int j = 0; j < _BannerCollection.Count; j++)
                            {
                                string strImage = FetConstant.strhrf + _BannerCollection[j].BannePath;
                                str += "  new Array('" + strImage + "', '" + _BannerCollection[j].BannerLink + "', '" + FetConstant.strTagetBlak + "', " + _Tb_Size.WidthSize + ", " + _Tb_Size.HightSize + ", " + _BannerLocationCollection[i].BannerLocationId + ", 0),";
                            }
                        }
                    }
                    else
                    {
                        Tb_Size _Tb_Size = Tb_SizeService.GetTb_Size(_BannerLocationCollection[i].SizeID);
                        width0 = _Tb_Size.WidthSize.ToString();
                        height0 = _Tb_Size.HightSize.ToString();
                        Criteria crite = new Criteria();
                        crite.add(BannerColumns.BannerLocationId, _BannerLocationCollection[i].BannerLocationId, Condition.EQUAL, Condition.AND);
                        crite.add(BannerColumns.StatusId, FetConstant._active, Condition.EQUAL, Condition.AND);
                        BannerCollection _BannerCollection = BannerService.GetBannerListByParam(BannerColumns.Viewed, OrderDirection.ASC, crite.Criter);
                        if (_BannerCollection.Count > 0)
                        {
                            countBanner = int.Parse(_BannerCollection.Count.ToString()) - 1;

                            for (int j = 0; j < _BannerCollection.Count; j++)
                            {
                                if (countBanner > j)
                                {
                                    string strImage = FetConstant.strhrf + _BannerCollection[j].BannePath;
                                    str += "  new Array('" + strImage + "', '" + _BannerCollection[j].BannerLink + "', '" + FetConstant.strTagetBlak + "', " + _Tb_Size.WidthSize + ", " + _Tb_Size.HightSize + ", " + _BannerLocationCollection[i].BannerLocationId + ", 0),";
                                }
                                else
                                {
                                    string strImage = FetConstant.strhrf + _BannerCollection[j].BannePath;
                                    str += "  new Array('" + strImage + "', '" + _BannerCollection[j].BannerLink + "', '" + FetConstant.strTagetBlak + "', " + _Tb_Size.WidthSize + ", " + _Tb_Size.HightSize + ", " + _BannerLocationCollection[i].BannerLocationId + ", 0)";
                                }
                            }
                        }
                    }
                }
                str += ");";
                str += "    </script>";
            }
        }
        return str;
    }
    #endregion end adv Brand
    #region start adv DBDN
    public static string LoadDBDNRight()
    {
        string str = "";
        Criteria cri = new Criteria();
        cri.add("[" + CatLocation._Table + "].[" + CatLocationColumns.Title + "]", FetConstant.DBDNRight, Condition.LIKE, Condition.AND);
        cri.add("[" + CatLocation._Table + "].[" + CatLocationColumns.Enable + "]", 1, Condition.LIKE, Condition.AND);
        CatLocationCollection _CatLocationCollection = CatLocationService.GetCatLocationListByParam(CatLocationColumns.LocationId, OrderDirection.ASC, cri.Criter);
        if (_CatLocationCollection.Count > 0)
        {
            Criteria crit = new Criteria();
            crit.add(BannerLocationColumns.CatLocationId, _CatLocationCollection[0].LocationId, Condition.EQUAL, Condition.AND);
            crit.add(BannerLocationColumns.Enable, 1, Condition.EQUAL, Condition.AND);
            BannerLocationCollection _BannerLocationCollection = BannerLocationService.GetBannerLocationListByParam("[" + BannerLocation._Table + "].[" + BannerLocationColumns.Order + "]", OrderDirection.ASC, crit.Criter);
            string width0 = "";
            string height0 = "";
            int countLocation = 0;
            int countBanner = 0;
            if (_BannerLocationCollection.Count > 0)
            {
                countLocation = int.Parse(_BannerLocationCollection.Count.ToString()) - 1;
                str += " <script type='text/javascript'>";
                str += "     var VarDBDNRight = new Array(";
                for (int i = 0; i < _BannerLocationCollection.Count; i++)
                {
                    if (countLocation > i)
                    {
                        Tb_Size _Tb_Size = Tb_SizeService.GetTb_Size(_BannerLocationCollection[i].SizeID);
                        Criteria crite = new Criteria();
                        crite.add(BannerColumns.BannerLocationId, _BannerLocationCollection[i].BannerLocationId, Condition.EQUAL, Condition.AND);
                        crite.add(BannerColumns.StatusId, FetConstant._active, Condition.EQUAL, Condition.AND);
                        BannerCollection _BannerCollection = BannerService.GetBannerListByParam(BannerColumns.Viewed, OrderDirection.ASC, crite.Criter);

                        if (_BannerCollection.Count > 0)
                        {
                            for (int j = 0; j < _BannerCollection.Count; j++)
                            {
                                string strImage = FetConstant.strhrf + _BannerCollection[j].BannePath;
                                str += "  new Array('" + strImage + "', '" + _BannerCollection[j].BannerLink + "', '" + FetConstant.strTagetBlak + "', " + _Tb_Size.WidthSize + ", " + _Tb_Size.HightSize + ", " + _BannerLocationCollection[i].BannerLocationId + ", 0),";
                            }
                        }
                    }
                    else
                    {
                        Tb_Size _Tb_Size = Tb_SizeService.GetTb_Size(_BannerLocationCollection[i].SizeID);
                        width0 = _Tb_Size.WidthSize.ToString();
                        height0 = _Tb_Size.HightSize.ToString();
                        Criteria crite = new Criteria();
                        crite.add(BannerColumns.BannerLocationId, _BannerLocationCollection[i].BannerLocationId, Condition.EQUAL, Condition.AND);
                        crite.add(BannerColumns.StatusId, FetConstant._active, Condition.EQUAL, Condition.AND);
                        BannerCollection _BannerCollection = BannerService.GetBannerListByParam(BannerColumns.Viewed, OrderDirection.ASC, crite.Criter);
                        if (_BannerCollection.Count > 0)
                        {
                            countBanner = int.Parse(_BannerCollection.Count.ToString()) - 1;

                            for (int j = 0; j < _BannerCollection.Count; j++)
                            {
                                if (countBanner > j)
                                {
                                    string strImage = FetConstant.strhrf + _BannerCollection[j].BannePath;
                                    str += "  new Array('" + strImage + "', '" + _BannerCollection[j].BannerLink + "', '" + FetConstant.strTagetBlak + "', " + _Tb_Size.WidthSize + ", " + _Tb_Size.HightSize + ", " + _BannerLocationCollection[i].BannerLocationId + ", 0),";
                                }
                                else
                                {
                                    string strImage = FetConstant.strhrf + _BannerCollection[j].BannePath;
                                    str += "  new Array('" + strImage + "', '" + _BannerCollection[j].BannerLink + "', '" + FetConstant.strTagetBlak + "', " + _Tb_Size.WidthSize + ", " + _Tb_Size.HightSize + ", " + _BannerLocationCollection[i].BannerLocationId + ", 0)";
                                }
                            }
                        }
                    }
                }
                str += ");";
                str += "    </script>";
            }
        }
        return str;
    }
    #endregion end adv DBDN
}
